package cn.xorange.commons.system.service.platform.impl;

import cn.xorange.commons.core.basic.service.BaseService;
import cn.xorange.commons.security.utils.SecurityUtils;
import cn.xorange.commons.system.entity.platform.SysAgreement;
import cn.xorange.commons.system.mapper.platform.SysAgreementMapper;
import cn.xorange.commons.system.service.platform.ISysAgreementService;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.TimerTask;

/**
 * @author : yangjian
 * date : 2022/1/28
 */
@Service
public class SysAgreementServiceImpl extends BaseService<SysAgreement, SysAgreementMapper> implements ISysAgreementService {

    @Override
    public TimerTask insertSysAgreementLog(Long... agreementIds) {
        Long userId = SecurityUtils.getUserId();
        return new TimerTask() {
            @Override
            public void run() {
                for (Long id : agreementIds){
                    mapper.InsertSysAgreementLog(userId,id,new Date());
                }
            }
        };
    }

}
